home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / tool_inc.zip / ATTACH.INT < prev    next >
Text File  |  1989-03-01  |  3KB  |  75 lines

  1.  
  2. (*
  3.  * Copyright 1987, 1989 Samuel H. Smith;  All rights reserved
  4.  *
  5.  * This is a component of the ProDoor System.
  6.  * Do not distribute modified versions without my permission.
  7.  * Do not remove or alter this notice or any other copyright notice.
  8.  * If you use this in your own program you must distribute source code.
  9.  * Do not use any of this in a commercial product.
  10.  *
  11.  *)
  12.  
  13. type
  14.    longlink = record
  15.       ofs:  integer;
  16.       seg:  integer;
  17.    end;
  18.  
  19. procedure DISABLE_INT;
  20.    inline($FA);
  21.    (* disable further processor interrupts *)
  22.  
  23. procedure ENABLE_INT;
  24.    inline($FB);
  25.    (* enable processor interrupts *)
  26.  
  27. procedure ENTER_INTERRUPT;
  28.    (* prologue for interrupt handlers *)
  29.    inline($90);
  30.  
  31. procedure LINK_CALL(vec: longlink);
  32.    (* call the old handler through the *)      
  33.    (* specified link variable *)               
  34.    inline($2E/$FF/$1E{/>vec});       (* call far cs:oldvec *)
  35.  
  36. procedure LINK_JMP(vec: longlink);
  37.    (* epilogue for interrupt handlers *)       
  38.    (* jumping to the old handler through *)    
  39.    (* the specified link variable *)           
  40.    inline($1F/          (* pop ds *)           
  41.           $07/          (* pop es *)           
  42.           $5E/          (* pop si *)           
  43.           $5F/          (* pop di *)           
  44.           $5A/          (* pop dx *)           
  45.           $59/          (* pop cx *)           
  46.           $5B/          (* pop bx *)           
  47.           $58/          (* pop ax *)           
  48.           $89/$EC/      (* mov sp,bp *)        
  49.           $5D/          (* pop bp *)           
  50.           $2E/$FF/$2E{/>vec});     (* jmp far cs:oldvec *)
  51.  
  52. procedure EXIT_INTERRUPT;
  53.    (* epilogue for interrupt handlers *)       
  54.    (* does not call old handler at all *)      
  55.    inline($90);
  56.  
  57. procedure get_handler(vector:      integer;     {vector number}
  58.                       var link:    longlink);   {cseg link to old handler}
  59.  
  60.    (* get a pointer to the current handler for an interrupt vector *)
  61.  
  62. procedure attach_handler(vector:      integer;     {vector number}
  63.                          handler:     integer;     {cseg ofs of new handler}
  64.                          var link:    longlink);   {cseg link to old handler}
  65.  
  66.    (* attach an interrupt handler to the specified vector number;
  67.       handler is the cseg offset of the new handler; link will
  68.       contain a long pointer to the previous handler *)
  69.  
  70. procedure remove_handler(vector:      integer;     {vector number}
  71.                          var link:    longlink);   {cseg link to old handler}
  72.  
  73.    (* remove an interrupt handler and replace the old handler *)
  74.  
  75.